Implement get_root_origin generically for all backends
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 17 Mar 2014 19:39:39 +0000 (15:39 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 17 Mar 2014 19:51:46 +0000 (15:51 -0400)
It seems that some backends implemented get_root_origin wrong
and returned the client window coordinates, not the frame window
coordinates. Since it's possible to implement generically for all
windows, let's do that instead of having a separate impl vfunc.

gdk/broadway/gdkwindow-broadway.c
gdk/gdkoffscreenwindow.c
gdk/gdkwindow.c
gdk/gdkwindowimpl.h
gdk/quartz/gdkwindow-quartz.c
gdk/wayland/gdkwindow-wayland.c
gdk/win32/gdkwindow-win32.c
gdk/x11/gdkwindow-x11.c

index fa541c80f2c818d356dbb7db1b51b6d9fe15819b..97cb6cf94c37d549a97e695426640285a30b06f3 100644 (file)
@@ -724,24 +724,6 @@ gdk_window_broadway_get_root_coords (GdkWindow *window,
     *root_y = y + impl->wrapper->y;
 }
 
-static void
-gdk_broadway_window_get_root_origin (GdkWindow *window,
-                                    gint      *x,
-                                    gint      *y)
-{
-  GdkWindowImplBroadway *impl;
-
-  impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
-
-  /* TODO: This should take wm frame into account */
-
-  if (x)
-    *x = impl->wrapper->x;
-
-  if (y)
-    *y = impl->wrapper->x;
-}
-
 static void
 gdk_broadway_window_get_frame_extents (GdkWindow    *window,
                                       GdkRectangle *rect)
@@ -1584,7 +1566,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
   impl_class->set_role = gdk_broadway_window_set_role;
   impl_class->set_startup_id = gdk_broadway_window_set_startup_id;
   impl_class->set_transient_for = gdk_broadway_window_set_transient_for;
-  impl_class->get_root_origin = gdk_broadway_window_get_root_origin;
   impl_class->get_frame_extents = gdk_broadway_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_broadway_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_broadway_window_set_accept_focus;
index a5a413bf0a399ef93ff4736052ccd90f85643cf9..9276103ca0f23c45b61f41196444910dec71186d 100644 (file)
@@ -743,7 +743,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
   impl_class->set_role = gdk_offscreen_window_set_string;
   impl_class->set_startup_id = gdk_offscreen_window_set_string;
   impl_class->set_transient_for = gdk_offscreen_window_set_transient_for;
-  impl_class->get_root_origin = NULL;
   impl_class->get_frame_extents = gdk_offscreen_window_get_frame_extents;
   impl_class->set_override_redirect = NULL;
   impl_class->set_accept_focus = NULL;
index 17c6d09431284e7b1ef3a528295f2f0db675f1ee..acecc878c0e9c6c935e6db5d042ea58d3dfbcdf0 100644 (file)
@@ -9630,7 +9630,15 @@ gdk_window_get_root_origin (GdkWindow *window,
                            gint      *x,
                            gint      *y)
 {
-  GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_root_origin (window, x, y);
+  GdkRectangle rect;
+
+  gdk_window_get_frame_extents (window, &rect);
+
+  if (x)
+    *x = rect.x;
+
+  if (y)
+    *y = rect.y;
 }
 
 /**
index d8b0ff499156bf940ed43cdf32a30659c246c368..bd1714d7f710145598a9b0c02ac74574409cacf9 100644 (file)
@@ -194,9 +194,6 @@ struct _GdkWindowImplClass
                                         const gchar *startup_id);
   void         (* set_transient_for)    (GdkWindow *window,
                                         GdkWindow *parent);
-  void         (* get_root_origin)      (GdkWindow *window,
-                                        gint      *x,
-                                        gint      *y);
   void         (* get_frame_extents)    (GdkWindow    *window,
                                         GdkRectangle *rect);
   void         (* set_override_redirect) (GdkWindow *window,
index cfa211a9e01389ab94e52236a5bcfba5aa770490..84e7ab871d33098701c8d54fca22d7c40fff79d4 100644 (file)
@@ -1791,25 +1791,6 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
     *root_y = tmp_y;
 }
 
-static void
-gdk_quartz_window_get_root_origin (GdkWindow *window,
-                                   gint      *x,
-                                   gint      *y)
-{
-  GdkRectangle rect;
-
-  rect.x = 0;
-  rect.y = 0;
-  
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-}
-
 /* Returns coordinates relative to the passed in window. */
 static GdkWindow *
 gdk_window_quartz_get_device_state_helper (GdkWindow       *window,
@@ -2987,7 +2968,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
   impl_class->set_role = gdk_quartz_window_set_role;
   impl_class->set_startup_id = gdk_quartz_window_set_startup_id;
   impl_class->set_transient_for = gdk_quartz_window_set_transient_for;
-  impl_class->get_root_origin = gdk_quartz_window_get_root_origin;
   impl_class->get_frame_extents = gdk_quartz_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_quartz_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_quartz_window_set_accept_focus;
index b6d3811a73ef3d828de3a44b206091fff6eb0795..c419714e746040e3f4d4f7e54a0c29990e28ac60 100644 (file)
@@ -1663,18 +1663,6 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
   gdk_wayland_window_sync_transient_for (window);
 }
 
-static void
-gdk_wayland_window_get_root_origin (GdkWindow *window,
-                                   gint      *x,
-                                   gint      *y)
-{
-  if (x)
-    *x = 0;
-
-  if (y)
-    *y = 0;
-}
-
 static void
 gdk_wayland_window_get_frame_extents (GdkWindow    *window,
                                       GdkRectangle *rect)
@@ -2226,7 +2214,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
   impl_class->set_role = gdk_wayland_window_set_role;
   impl_class->set_startup_id = gdk_wayland_window_set_startup_id;
   impl_class->set_transient_for = gdk_wayland_window_set_transient_for;
-  impl_class->get_root_origin = gdk_wayland_window_get_root_origin;
   impl_class->get_frame_extents = gdk_wayland_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_wayland_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_wayland_window_set_accept_focus;
index 35a49b73d787658b776422b2ba6506b02d3f3f5b..aa8f5916ea6f8c162044ab7b1bb0612c432b577d 100644 (file)
@@ -2063,27 +2063,6 @@ gdk_win32_window_restack_toplevel (GdkWindow *window,
        // ### TODO
 }
 
-static void
-gdk_win32_window_get_root_origin (GdkWindow *window,
-                           gint      *x,
-                           gint      *y)
-{
-  GdkRectangle rect;
-
-  g_return_if_fail (GDK_IS_WINDOW (window));
-
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-
-  GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %p: %+d%+d\n",
-                          GDK_WINDOW_HWND (window), rect.x, rect.y));
-}
-
 static void
 gdk_win32_window_get_frame_extents (GdkWindow    *window,
                               GdkRectangle *rect)
@@ -3472,7 +3451,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
   impl_class->set_role = gdk_win32_window_set_role;
   //impl_class->set_startup_id = gdk_x11_window_set_startup_id;
   impl_class->set_transient_for = gdk_win32_window_set_transient_for;
-  impl_class->get_root_origin = gdk_win32_window_get_root_origin;
   impl_class->get_frame_extents = gdk_win32_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_win32_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_win32_window_set_accept_focus;
index 83b3c7bf41e43f1bd7a777cb4193bdc11cb9b197..0856f8a57e75f28a72e6de2513ffb704bb58bae3 100644 (file)
@@ -3113,22 +3113,6 @@ gdk_window_x11_get_root_coords (GdkWindow *window,
     *root_y = ty / impl->window_scale;
 }
 
-static void
-gdk_x11_window_get_root_origin (GdkWindow *window,
-                           gint      *x,
-                           gint      *y)
-{
-  GdkRectangle rect;
-
-  gdk_window_get_frame_extents (window, &rect);
-
-  if (x)
-    *x = rect.x;
-
-  if (y)
-    *y = rect.y;
-}
-
 static void
 gdk_x11_window_get_frame_extents (GdkWindow    *window,
                                   GdkRectangle *rect)
@@ -5766,7 +5750,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
   impl_class->set_role = gdk_x11_window_set_role;
   impl_class->set_startup_id = gdk_x11_window_set_startup_id;
   impl_class->set_transient_for = gdk_x11_window_set_transient_for;
-  impl_class->get_root_origin = gdk_x11_window_get_root_origin;
   impl_class->get_frame_extents = gdk_x11_window_get_frame_extents;
   impl_class->set_override_redirect = gdk_x11_window_set_override_redirect;
   impl_class->set_accept_focus = gdk_x11_window_set_accept_focus;